﻿using System;
using System.Windows;
using System.Windows.Media;
using System.Windows.Data;
using Telerik.Windows.Controls;

namespace MedLink2011.Views.Patients.Controls.FirstLook.Converters
{
    public class CategoryToBackgroundConverter: IValueConverter
    {

        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value == null)
            {

                return Colors.Transparent;
            }
            if (value.GetType() == typeof(Category))
            {
                switch (((Category)value).CategoryName)
                {
                    case "WebDevelopement": return Application.Current.Resources["WebDevelopementBrush"];
                    case "Architectures": return Application.Current.Resources["ArchitecturesBrush"];
                    case "DataLayers": return Application.Current.Resources["DataLayersBrush"];
                    case "Sharepoint": return Application.Current.Resources["SharepointBrush"];
                    case "WindowsAndFrameworks": return Application.Current.Resources["WindowsAndFrameworksBrush"];
                    case "LunchAndCoffee": return Application.Current.Resources["LunchAndCoffeeBrush"];
                    default: return Application.Current.Resources["LunchAndCoffeeBrush"];
                }
            }
            else
            {
                return Application.Current.Resources[value.ToString() +"Brush"];
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
